#include "../src/mkvPlayer.hpp"
#include <iostream>
#include <filesystem>
#include <stdexcept>
#include <unistd.h>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb_image_write.h>

int main()
{
  gst_init(nullptr,nullptr);
  if(!std::filesystem::exists("test.mkv"))
    throw std::runtime_error("无法打开test.mkv");
  MKVPlayer player;
  player.funcNewImageCallback=[](const char* data,int,int){
    stbi_write_bmp("test_mkv_img.bmp", 1920, 1080, 3, data);
    std::cout<<"Get New Image"<<std::endl;
  };
  player.Start("test.mkv",true);
  sleep(2000);
  return 0;
}
